package com.fjnldx.mes.controller.scheduling;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjnldx.mes.domain.domainReq.DevSnSelectedStatusReq;
import com.fjnldx.mes.domain.domainReq.GongXu;
import com.fjnldx.mes.domain.domainReq.Group;
import com.fjnldx.mes.domain.domainReq.SchedulingPersonnelReq;
import com.fjnldx.mes.domain.domainRes.Result;
import com.fjnldx.mes.domain.domainRes.Results;
import com.fjnldx.mes.domain.pojo.*;
import com.fjnldx.mes.service.scheduling.SchedulingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/scheduling/personnel")
@Api(value = "人员排班", tags = "人员排班")
public class SchedulingController {
    @Resource
    SchedulingService schedulingService;

    @GetMapping("/getEquipmentByGx")
    @ApiOperation(value = "获取工序设备号", notes = "获取工序设备号")
    public Result getEquipmentByGx(GongXu params) {
        return schedulingService.getEquipmentByGx(params);
    }

    @GetMapping("/getDevSnSelectedStatus")
    @ApiOperation(value = "获取机台选择状态", notes = "获取机台选择状态")
    public Result getDevSnSelectedStatus(DevSnSelectedStatusReq params) {
        return schedulingService.getDevSnSelectedStatus(params);
    }

    @GetMapping("/setDevSnSelectedStatus")
    @ApiOperation(value = "设置机台选择状态", notes = "设置机台选择状态")
    public Result setDevSnSelectedStatus(DevSnSelectedStatusPojo params, String[] devSnList) {
        return schedulingService.setDevSnSelectedStatus(params, devSnList);
    }

    @PostMapping("/queryPersonnelGroup")
    @ApiOperation(value = "人员管理-集团-级联", notes = "人员管理-集团-级联")
    public Result queryPersonnelGroup() throws Exception {
        return schedulingService.queryPersonnelGroup();
    }

    @PostMapping("/queryPersonnelGroupAndOrg")
    @ApiOperation(value = "人员管理-集团-组织-级联", notes = "人员管理-集团-组织-级联")
    public Result queryPersonnelGroupAndOrg(@RequestBody Group data) throws Exception {
        return schedulingService.queryPersonnelGroupAndOrg(data);
    }

    @GetMapping("/queryPersonnelClasses")
    @ApiOperation(value = "查询人员排班记录", notes = "查询人员排班记录")
    public Results queryPersonnelClasses(SchedulingReq data, Page page) {
        return schedulingService.queryPersonnelClasses(data,page);
    }

    @PostMapping("/deletePersonnelClasses")
    @ApiOperation(value = "移除该人员排班", notes = "移除该人员排班")
    public Result deletePersonnelClasses(@RequestBody SchedulingReqOfName data)  {
        return schedulingService.deletePersonnelClasses(data);
    }

    @PostMapping("/addPersonnelClasses")
    @ApiOperation(value = "新增人员排班", notes = "新增人员排班")
    public Result addPersonnelClasses(@RequestBody Scheduling data) throws Exception {
        return schedulingService.addPersonnelClasses(data);
    }

    @PostMapping("/modifyPersonnelClasses")
    @ApiOperation(value = "修改人员排班", notes = "修改人员排班")
    public Result modifyPersonnelClasses(@RequestBody SchedulingShow data) {
        return schedulingService.modifyPersonnelClasses(data);
    }

    @PostMapping("/addPersonnel")
    @ApiOperation(value = "新增人员信息（单个）", notes = "新增人员信息（单个）")
    public Result addPersonnel(@RequestBody SchedulingPersonnel data) throws Exception {
        return schedulingService.addPersonnel(data);
    }

    @PostMapping("/modifyPersonnel")
    @ApiOperation(value = "修改人员信息", notes = "修改人员信息")
    public Result modifyPersonnel(@RequestBody SchedulingPersonnel data) throws Exception {
        return schedulingService.modifyPersonnel(data);
    }

    @PostMapping("/deletePersonnel")
    @ApiOperation(value = "删除人员信息", notes = "删除人员信息")
    public Result deletePersonnel(@RequestBody String[] array) throws Exception {
        return schedulingService.deletePersonnel(array);
    }

    @PostMapping("/queryPersonnel")
    @ApiOperation(value = "多条件查询人员信息", notes = "多条件查询人员信息")
    public Result queryPersonnel(@RequestBody SchedulingPersonnelReq data) throws Exception {
        return schedulingService.queryPersonnel(data);
    }

}
